home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / PowerPC / PPC News 3014 < prev    next >
Encoding:
Text File  |  1994-05-26  |  7.6 KB  |  133 lines  |  [TEXT/ttxt]

  1. TO OPTIMISE, OR NOT TO OPTIMISE, THAT IS THE QUESTION.
  2.  
  3. (May 13th) When Intel Corp announced the Pentium, one question that
  4. taxed the company was the extent to which applications needed to be
  5. recompiled to get the best out of the chip. It wasn't that recompilation
  6. was needed for the application to run, it was simply that to get the
  7. last ounce of performance out of the processor, the compiler had to be
  8. aware of some of the new features that the new chip offered. Intel
  9. acknowledged that some applications could benefit substantially by being
  10. optimised for Pentium - on average they could run 30% faster. But surely
  11. optimising for Pentium meant de-optimising for the i386 and i486
  12. processor? At this point, the Intel public relations line tends to be
  13. "Oh No - optimise for Pentium and you will also optimise for the 486".
  14. At which point the skeptic gets a little skeptical. To be fair, Intel is
  15. probably right - it is possible to include optimisations for a chip with
  16. inbuilt pipelining and parallel execution without damaging its speed of
  17. execution on a simpler processor.
  18.  
  19. Today the same questions can be asked of the PowerPC family of chips. If
  20. I optimise my code specfically for the PowerPC 604, how much extra speed
  21. will I be able to squeeze out of the processor? If I optimise for the
  22. 601, will I get sub standard performance if the code runs on a 603 or a
  23. 604, or vice versa?
  24.  
  25. A number of compiler writers will point out that at this stage the
  26. question is a little premature. "Here we are with a familly of chips
  27. that goes blindingly fast and you want to worry about squeezing out the
  28. last drop of performance", they cry, quite rightly. However, we'll ask
  29. it anyway, since it is a question that will become important to the
  30. software community in the next year or so.
  31.  
  32. As with so many questions, the answer is "it depends", according to Mike
  33. Phillip, who manages Motorola's RISC compiler tools group. It depends on
  34. the kind of application, on the design of the target computer system and
  35. on the compiler. Given all those imponderables, however, he says, full
  36. optimisation for the 604 might result in a 10% increase in performance.
  37. The question then becomes, how much will optimising for one processor,
  38. slug performance on the others. Again, says Phillip, there is no simple
  39. answer, but generally compiling for a chip with a large degree of
  40. internal parallelism (such as the 604) will not impact a more lowly
  41. processor too badly.
  42.  
  43. One way to get a good approximation of the truth would be to run
  44. optimised SPECmark code on one processor and then on the other.
  45. Unfortunately, no-one has done this yet, partly because all those
  46. SPECint and SPECfp figures that you have seen for the 604 seem to have
  47. been generated by simulation, rather than by compiling actual code. It
  48. is generally accepted that there will be a performance hit of some kind,
  49. but nobody has figures. PowerPC News is keen to hear from anyone who has
  50. run comparative tests.
  51.  
  52. The degree of parallelism is just one way in which the different members
  53. of the PowerPC family differ. Apart from the obvious multiple integer
  54. units, the 604 also has a re-engineered floating-point unit. As we said
  55. in the last issue, the PPC604 is a single pass double-precision unit,
  56. meaning that both single- and double-precision operations zip through
  57. the chip in one pass with a latency of 3 cycles. Essentially, it has two
  58. multiply units for double precision operands. The 601 and the 603, by
  59. contrast, require double precision to travel the pipeline twice, giving
  60. a 4-cycle latency and 2-cycle throughput. Coupled with the fact that the
  61. 604 now has two "wait station" queueing places in front of the floating
  62. point unit then a compiler-writer has one or two things to continue when
  63. getting the best out of the processor.
  64.  
  65. Nearly as important for scientific applications is the organisation of
  66. the cache on the target machine. Different processors have their cache
  67. aranged in different ways. The 604, for example, has separate data and
  68. instruction caches on-board, while the 601 unifies them, but that will
  69. not make too much difference to the compiler, Phillip says. More
  70. important is the size and organisation of the of the Level 2 off-chip
  71. cache. Since commercial application developers will have no idea what
  72. kind of cache their customers' machines will have, caching will most
  73. probably be ignored. In any case, says Phillip, it will be the
  74. scientific, memory-bound applications that will notice the difference.
  75.  
  76. Last but not least, there are the differences in instruction set between
  77. the various processors. The most trivial example of this are the extra
  78. instructions that were retained from the old POWER architecture in the
  79. PowerPC 601. For more details, have a look at the History of the PowerPC
  80. part 1 (select 3000). However, the fact is the 601 includes many
  81. instructions which are not strictly part of the PowerPC set, but are
  82. there to provide a bridge between the two architectures. The advantage
  83. is that software from an old RS/6000 will usually run fine, without a
  84. recompile on the the 601-based RS/6000s. Theoretically, a piece of code
  85. aggressively optimised for the 601 might take some of these "bridging"
  86. instructions, causing all kinds of nasties when it runs on the 604 or
  87. 603, as the processor could trap the illegal instructions.
  88.  
  89. This admittedly, is a daft example, though there is probably someone out
  90. there who is trying to make a 601 application go faster using these
  91. methods. It is worth noting, however, that both the 603 and 604
  92. processors also have additional instructions in them, which are not
  93. included in the 601. These are the so-called "graphics instructions":
  94.  
  95.   stfiwx - Store floating-point as Integer Word
  96.   fres   - Floating Reciprocal Estimate Single
  97.   frsqrte - Floating Reciprocal Square Root Estimate
  98.   fsel   - Floating point Select
  99.  
  100. Examples of how these instructions can be used in graphical applications
  101. are given in Appendix E of the PowerPC documentation and they are
  102. basically quick 'n dirty ways of carrying out floating point operations
  103. where speed is more important than accuracy. Useful as they are, they
  104. are not supported by the 601 processor and will generate an error. So
  105. can they be safely used at all?
  106.  
  107. Currently, the wisdom from the IBM and Motorola compiler divisions is
  108. that these kind of instructions will not be generated by everyday
  109. compilers, instead they will appear in specialised graphics libraries.
  110. Philip suggests that people may adopt a method of using dynamically
  111. linkable libraries, which can be swapped in at run-time depending on the
  112. processor in use. If they are restricted to specialist graphical library
  113. use, there should not be too many problems. However, other informed
  114. IBMers suggest that these instructions will become more pervasive over
  115. time as the focus switches to floating point usage in general
  116. applications.
  117.  
  118. So what is the answer? Motorola's Phillip suggests one solution may be
  119. smart installers. In Motorola's compilers, like many others, switches
  120. abound. Developers can compile for particular targets, and for
  121. particular chips. They also allow for the production of multiple sets of
  122. object code. So, an installation CD-ROM could hold multiple copies of
  123. (parts of?) the application, together with a smart installer that could
  124. read the system configuration, processor-type etc, and copy the most
  125. suitable code across. It is an evolution of the fat binary idea. Will it
  126. catch on? We don't know because until definitive SPECmarks or other
  127. benchmarks are run, it is not certain whether there is even an issue.
  128. Watch out for the launch of the first 604-based Macintoshes, however, as
  129. that is when we will see the subject apear again.
  130.  
  131. (c)PowerPC News - Free by mailing: add@power.globalnews.com
  132.  
  133.